home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group01b.txt
/
000175_icon-group-sender_Sat Nov 24 15:35:13 2001.msg
< prev
next >
Wrap
Internet Message Format
|
2002-01-03
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id fAOMVoQ22251
for icon-group-addresses; Sat, 24 Nov 2001 15:31:50 -0700 (MST)
Message-Id: <200111242231.fAOMVoQ22251@baskerville.CS.Arizona.EDU>
From: Art Eschenlauer <art.eschenlauer@sufsys.com>
To: "'icon-group@CS.Arizona.EDU '" <icon-group@cs.arizona.edu>
Subject: compact idiom to reference Nth result? e.g., every s := ("a"|"b"|
"c"|"d")\3 ; write (s)
Date: Thu, 22 Nov 2001 05:40:23 -0600
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1101
Is there a compact way to reference the Nth result in the set of results
produced by an expression?
For example, suppose that I want to obtain the third result produced by the
expression ("a"|"b"|"c"|"d"). Thinking in my stone-age procedural way, I
would write:
procedure main()
i := 0
every s := ("a"|"b"|"c"|"d") do {
write ("s = "||s)
i +:= 1
if i = 3 then {
write ("i = "||i)
write(s)
break
}
}
end
I suppose that I could do this with a co-expression:
procedure main()
E := create ("a"|"b"|"c"|"d")
i := 0
while s := ! @E do {
write ("s = "||s)
i +:= 1
if i = 3 then {
write ("i = "||i)
write(s)
break
}
}
end
but I don't think that immediately gives me much benefit.
What I'm hoping for is a compact syntax, similar to one of the following
examples except that it would actually work!
("a"|"b"|"c"|"d")[3]
3("a"|"b"|"c"|"d")
The most compact idiom I have come up with is:
every s := ("a"|"b"|"c"|"d")\3 ; write (s)
Any suggestions?
Is there an idiomatic way to get rid of the variable s for example?